import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router';
import { createRouterGuard } from '@/router/guard';
import { basicRoutes } from './constants';

const WEB_HASH = true;
const VITE_BASE_PATH = import.meta.env.VITE_BASE_PATH;

const router = createRouter({
  history: WEB_HASH ? createWebHashHistory(VITE_BASE_PATH) : createWebHistory(VITE_BASE_PATH),
  routes: basicRoutes as RouteRecordRaw[],
  strict: true,
  scrollBehavior: () => ({left: 0, top: 0}),
});

createRouterGuard(router);

export default router;
